#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <queue>
#include <set>
#include <algorithm>
#include <stack>
#include <string>
using namespace std;
char numbers[10][100] = {
    "+[+![]]",
    "+[+!![]]",
    "+[!![]+!![]]",
    "+[!![]+!![]+!![]]",
    "+[!![]+!![]+!![]+!![]]",
    "+[!![]+!![]+!![]+!![]+!![]]",
    "+[[!![]+!![]]*[!![]+!![]+!![]]]",
    "+[+!![]+[+![]]-!![]-!![]-!![]]",
    "+[+!![]+[+![]]-!![]-!![]]",
    "+[+!![]+[+![]]-!![]]",
};
char chars[10][100] = {
    "[+![]]",
    "[+!![]]",
    "[!![]+!![]]",
    "[!![]+!![]+!![]]",
    "[!![]+!![]+!![]+!![]]",
    "[!![]+!![]+!![]+!![]+!![]]",
    "[[!![]+!![]]*[!![]+!![]+!![]]]",
    "[+!![]+[+![]]-!![]-!![]-!![]]",
    "[+!![]+[+![]]-!![]-!![]]",
    "[+!![]+[+![]]-!![]]",
};
int main()
{
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    int t, n;
    scanf("%d", &t);
    while (t--)
    {
        scanf("%d", &n);
        if (n < 10) puts(numbers[n]);
        else if (n < 100) printf("+[%s+%s]\n", chars[n / 10], chars[n % 10]);
        else if (n < 1000) printf("+[%s+%s+%s]\n", chars[n / 100], chars[n / 10 % 10], chars[n % 10]);
        else printf("+[%s+%s+%s]+!![]\n", chars[9], chars[9], chars[9]);
    }
    return 0;
}
